import React, { Component } from "react";
import Form from "./Form.jsx";

export default class Curd extends Component {
  constructor() {
    super();
    this.state = {
      list: [
        { name: "111", age: 20, id: +new Date() },
        { name: "222", age: 30, id: +new Date() },
      ],
    };
  }
  addListFn=(r)=>{
    console.log(r);
    let list = JSON.parse(JSON.stringify(this.state.list))
    list.push(r)
    this.setState({
        list:list
    })
    console.log(this.state.list);
  }
  render() {
    return (
      <div>
        <Form addList={this.addListFn}></Form>
       
      </div>
    );
  }
}
